Skip to content

2.2.0#33

Merged
makoni merged 188 commits intomasterfrom
develop
Jul 8, 2025
Merged

2.2.0#33
makoni merged 188 commits intomasterfrom
develop

Conversation

@makoni
Copy link
Owner

@makoni makoni commented Jul 8, 2025

Changelog for 2.2.0

This release focuses on improved error handling for "not found" cases and updates to related tests.


🛠 Improvements

Enhanced Not Found Error Handling

  • The get methods throughout the client now return a new, explicit notFound error when a requested document or resource does not exist.
  • The error includes details from the CouchDB response, making debugging and user feedback more clear and actionable.
  • Minor documentation and formatting updates.

Upgrade Notes:
If you rely on catching missing-document errors, update your error handling to use the new notFound case for more granular control.

Thank you for using couchdb-swift!

@makoni makoni requested a review from Copilot July 8, 2025 16:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for HTTP 404 responses by decoding CouchDB error payloads into a new notFound client error, updates localization, and adjusts tests.

  • Introduce CouchDBClientError.notFound(error:) and handle 404 in CouchDBClient.
  • Extend LocalizedError conformance and add NOT_FOUND_ERROR translations.
  • Update test14_get_document_not_found to expect the new error.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
Tests/CouchDBClientTests/CouchDBClientTests.swift Updated test14_get_document_not_found to catch CouchDBClientError.notFound error
Sources/CouchDBClient/Models/CouchDBClientError.swift Added .notFound case and localized messages in the error enum
Sources/CouchDBClient/CouchDBClient.swift Handle .notFound status by decoding body into CouchDBError and throwing .notFound
Sources/CouchDBClient/Localizable.xcstrings Removed duplicate conflict‐error entry and added translations for NOT_FOUND_ERROR
Comments suppressed due to low confidence (2)

Tests/CouchDBClientTests/CouchDBClientTests.swift:403

  • Add an assertion inside this catch to verify that the embedded CouchDBError contains the expected server error details (e.g., reason or status) so the test validates the decoding logic.
        } catch CouchDBClientError.notFound(_) {

Sources/CouchDBClient/Models/CouchDBClientError.swift:171

  • This case .notFound in the second localization switch duplicates an existing case label and will cause a compile-time error. Remove the redundant block.
		case .notFound:

@makoni makoni merged commit 1bc01cd into master Jul 8, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments